{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Phép cộng ma trận và vector"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### I. Cộng ma trận"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 1. Công thức"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](https://lh3.googleusercontent.com/n5LSBERWAqhKvUpBQFXLSIUD2Wt54x3eWhvz3Yh3Dzf33QGNCGiRkbDSPo2ueNIsQI8tPcCIIQQhcS0HVKz8clLtvf9LdanIyOSjiyfHA_nyRYwPrpHhBAPBQZSx0vDz34FI80NmPlT9etUoW7dUMqeruJ1Zot-F-qSCU-7X4mVqsCjITzzyRJ4JlB1FC0eKnrxqJV2kVSgfypsyBQJfPReIYl2ToORZI4acr2iC0UeyetJrSfl_dx53nOhtYqmc2v_Zq4IHyBVarQ7GCkdp-4TFDURnvURNBPUF8VU9l_nEkUQf1rmIvhAl9_QnGO9xQTOpTUw2m3rXm4ZrMAN9aKxT9yycMna2eAns4BLOAjZGyqmTRTYsL62I7SqEWcMFtSTL1JwaWQuAptGRrHlyfdbRm6LTS8fyHoTkIGaqtCB7VxX80tFrAvhGCwKyWSbjfL3gqwE5hrYVdnRO5Q2V8kMOoOnk18VW1x5MV7o8FxMsrwBeLaULBX70Rb3owpU6LAFu6MNbzWamd8iwb2oEdDKkiNgqgGOsV2LnJQKaesdlqrQO-40TTtOxXMDx1VVn92P5U4FJyrctCBmOefDTfEIfH5Xdo5mJxGAVeyk0aRMDHf1kK5fQOcwjyT-yZzettrTqIT_Q_i-92R-fXqpSP5J8OCl6pkM9flHslX_hexSVFF7xh9uP4ourZg=w537-h225-no)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Ảnh từ [Matrix_addition](https://en.wikipedia.org/wiki/Matrix_addition)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 2. Mô phỏng"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### a. Phép cộng"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](https://lh3.googleusercontent.com/M7Jp7VNQTw-76Brg7awuqVdMjCFKOLa5orgnO6ERk36XY-qK0YlUbHtfoGIRGrPYM1jzBl0aAPdPCHYciLGjQ3s8_0dLxnXbrg02KFF0Nqgz-vF9YI-jpXm58_kUhcFSEVSArotmOD878YmHNDK_Q1_RVncHtgXgZyUr_0bihwiG-CHxQUi1JZXgjKe47I-qoGoI-Cq5nAwVbmkkO4r3gMhxjdVHmLHN4RtEbhB1nsWzeN0YRzShQxGieEquWqhtWGBa6_BTzFCCYkuUccRSyr1fAIkqaVT6RhT1XK8Keo6xkvWN295Ql6_yj0c6fFCEimTHZSp8Eq7VFDrxD52alF74VwkLZxrH1k-zdDsmaNUOjC4gN-I5on8ZlgPfi5kdM7gVT3u9JAroH2ikiW9oEzUK1dqvD8F_T7du5Adc-ZNXwI5MrBhO0PwQ6eGU7JYAwWrXkMGFd6rz_Bva_T_R6zDDtdh1Vic-GxAVFby0NwlKYLj2kuzvCdwXmtRGRzkitX8wPfWVjjtSGbWFVRL5XKcFixcbLXcy-vEP3fJhnQhht3LczytZAFYhGhfaI8_xP7qO04zB4yQULxTy9d35CMlqpbjgD12RFlJQiQd_yfvfIunEmOcnbIUgRlSt44rBWuw2pbZNuRNsRDA2AEqVnelfKquhlJHJZtLZ7zI35WmIwBdbxhIqCj12jQ=w398-h78-no)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### b. Phép trừ"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](https://lh3.googleusercontent.com/rqVrVX8CloXLiEBzZiJBrkh-8G6WVy-dsJqmy9tCqEJlVydVu3-FJoJ0lqRb4ltDRqUGR-s34U4k-3MZ43ME2fWNpiu4JQMHSqNQ5gBPq7m8VP9nI-QrtoPAOvUUhBrY3jLAuS9eCUzJ0AqEW11WBXgNTgYkRWnnaMyqE3fxrimoI8fhDO7HMoZFYTJkBxjCkOCYxsxo-zWzpgcvMeIDZoR1sL-kBsLyCOBz-ypNFYWBCMkTlJpRMTXKivRkVsmgkQxbvjUvjzoTnyEqv-pNgkbQqK8MbavX9CI_BhI3tNg2i6-yLhcIT4pSO9nX0QD5EVNY-O9ZwjRd4hmeDjoocV7Sext--w2KTAIlpWUZwZUkDPVpoaUxpLwWJ8e1MNDOOJwAOAsUMYZNUlRCt3Bwa-w3FzqQsVGYKVtGvUGjrkCEqpztoNYyKiUXK8W267vZqGetEbJGb6vqZTB1kTeEgMeg73IuKBLgYBg79fEUDQMaKnLvLI0GE19FDaNva6HwA6JUM3dHTTztORvOe9Qy8GiVRqWnq8SDbiJpBhPPxPYbpec_9tQOAlppCTjMkvFWHhcvIdptzzLS7Zs4kVUJl8-iGG0BEKYyO4bt0A7lE3LuurQMTC5WK1Q4BQNjcpxLp--TmSNZKSr65V4sKliLgL7mjDfCtPh5gMkAMJdfp26WTEwBHRhtIK3rIA=w418-h80-no)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 3. Thực hành với Numpy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "A = np.array([\n",
    "    [1, 3],\n",
    "    [1, 0],\n",
    "    [1, 2]\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "B = np.array([\n",
    "    [0, 0],\n",
    "    [7, 5],\n",
    "    [2, 1]\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 3],\n",
       "       [8, 5],\n",
       "       [3, 3]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.add(A, B)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tương đương với"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 3],\n",
       "       [8, 5],\n",
       "       [3, 3]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A + B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
